<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>验证是不是数字</title>
</head>
<body>
<p id="demo">
    javascript能改变HTML元素的内容
</p>
<p id="aa">zheshishenme</p>
<input id="in1" type="text">
<script>
    function myFunction() {
        x=document.getElementById("demo");
        x.innerHTML="hello,world";

    }
    function myf() {
        a=document.getElementById("aa");
        a.style.color="#ff0000";
    }
    function my() {
        var b=document.getElementById("in1").value;
        if (b==""||isNaN(b))
        {
            alert("不是数字");
        }else{alert("是数字");}
    }
</script>
<button type="button" onclick="myFunction()">点击这里</button>
<button type="button" onclick="myf()">改变样式</button>
<button type="button" onclick="my()">验证是不是数字</button>
</body>
</html>